package com.recursivechaos.examples.sqlwatcher.hibernate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ScoutDAO extends DAO {
	Logger logger = LoggerFactory.getLogger(ScoutDAO.class);

	public void pingDB() {
		String trainName = "";
		try {
			begin();
			Scout scout = (Scout) getSession().get(Scout.class, "Frisco Flyer");
			commit();
			trainName = scout.getTrainName();
			logger.debug("Found data on database: " + trainName);
		} catch (Exception e) {
			// TODO: Issue "Fatal Error" triggering email
			rollback();
		} finally {
			close();
		}
	}

}
